<template>
	<view class="contact">
		<view class="listbox" v-for="(item,index) in arr" :key="index" @click="xiangqing(item)">
			<view class="topbox">
				<view class="time">
					<text>时间:</text>
					<text>{{item.answer_type.times}}</text>
				</view>
				<image
					src="http://fangguaner.oss-cn-chengdu.aliyuncs.com/upload/20210728/0038d21d17afcde0b83b736aa0feb252.png"
					mode="" v-if="item.level=='不及格'"></image>
				<image src="http://fangguaner.oss-cn-chengdu.aliyuncs.com/upload/20210728/60b1a83b8ac17f136264b47c6ed656e4.png" mode="" v-if="item.level=='及格'"></image>
			</view>
			<view class="hr"></view>
			<view class="center">
				<view class="left">
					<view class="neirong">
						{{item.answer_type.name}}
					</view>
					<view class="fenshubox">
						<view class="dui">
							<text>正确：</text>
							<text>{{item.correct_num}}</text>
						</view>
						<view class="cuo">
							<text>错误：</text>
							<text>{{item.error_num}}</text>
						</view>
					</view>
				</view>
				<view class="right">
					<view class="totaldata" v-if="item.level=='及格'">
						<text class="zongfen">{{item.score}}</text>
						<text>分</text>
					</view>
					<view class="totaldatas" v-if="item.level=='不及格'">
						<text class="zongfen">{{item.score}}</text>
						<text>分</text>
					</view>
					<view class="jifen">
						获<text class="fen" v-if="item.level=='及格'">{{item.integral}}</text><text class="fens" v-if="item.level=='不及格'">{{item.integral}}</text>积分
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {Togettheanswer} from "../../api/api/index"
	export default{
		data(){
			return{
				page:0,
				limit:20,
				isOk:false,
				arr:[]
			}
		},
		methods:{
			public(){
				if(this.isOk){
					return uni.showToast({
						title:"没有更多了",
						icon:"none",
						duration:1500
					})
				}
				uni.showLoading({
					mask: true,
					title: '加载中'
				})
				this.page++
				let data={page:this.page,limit:this.limit}
				Togettheanswer(data).then(res=>{
					uni.hideLoading()
					this.arr=this.arr.concat(res.data)
					if(res.data.length<this.limit){
						this.isOk=true
					}
				})
			},
			xiangqing(e){
				this.jumpLink({link:"/pages/kaohsihuigu/index",query:{id:e.id}})
			}
		},
		onLoad() {
		},
		onShow() {
			this.isOk=false
			this.page=0
			this.arr=[]
			this.public()
		},
		onReachBottom() {
			this.public()
		}
	}
</script>

<style scoped lang="less">
	.listbox {
		width: 709rpx;
		height: 202rpx;
		background-color: #ffffff;
		box-shadow: 0rpx 2rpx 5rpx 0rpx rgba(204, 204, 204, 0.72);
		border-radius: 10rpx;
		margin-top: 25rpx;
		margin-left: 20rpx;

		.topbox {
			display: flex;
			justify-content: space-between;

			.time {
				font-family: MicrosoftYaHei;
				font-size: 22rpx;
				color: #999999;
				margin-left: 16rpx;
				line-height: 65rpx;
			}

			image {
				width: 82rpx;
				height: 64rpx;
				margin-right: 29rpx;
			}
		}

		.hr {
			height: 1rpx;
			background-color: #eaeaea;
		}

		.center {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 10rpx;
			.left {
				margin-left: 16rpx;

				.neirong {
					width: 505rpx;
					font-family: MicrosoftYaHei-Bold;
					font-size: 26rpx;
					font-weight: normal;
					font-stretch: normal;
					line-height: 36rpx;
					letter-spacing: 0rpx;
					color: #333333;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.fenshubox {
					display: flex;
					justify-content: space-between;
					align-items: center;
					font-family: MicrosoftYaHei;
					font-size: 24rpx;
					width: 276rpx;
					margin-top: 30rpx;

					.dui {
						color: #FF8A00;
					}

					.cuo {
						color: #CC3300;
					}
				}
			}

			.right {
				margin-right: 20rpx;
				.totaldata {
					text-align: center;
					color: #00cc66;
					font-size: 22rpx;

					.zongfen {
						font-family: PingFang-SC-Heavy;
						font-size: 36rpx;
						font-weight: normal;
						font-stretch: normal;
						color: #00cc66;
					}
				}
				.totaldatas {
					text-align: center;
					color: #e00000;
					font-size: 22rpx;
				
					.zongfen {
						font-family: PingFang-SC-Heavy;
						font-size: 36rpx;
						font-weight: normal;
						font-stretch: normal;
						color: #e00000;
					}
				}
				.jifen {
					margin-top: 20rpx;
					font-family: MicrosoftYaHei;
					font-size: 24rpx;
					font-weight: normal;
					font-stretch: normal;
					color: #666666;
					.fen{
						color: #00cc66;
					}
					.fens{
						color: #e00000;
					}
				}
			}

		}
	}
</style>
